import logging
import unittest

from common import *
from Board import *
from RandomAgent import *
from AIAgentMinimax import *
from AIAgentOneLookAhead import *

class CreateBoard(unittest.TestCase):
    def setUp(self):
        pass
        
    def testVertical(self):
        b = Board(6)
        b.drop(1,1)
        b.drop(1,1)
        b.drop(1,1)
        b.drop(1,1)
        self.assertEqual((1,1,0), b.checkWin())
        b = Board(6)
        b.drop(5,1)
        b.drop(5,1)
        b.drop(5,1)
        b.drop(5,1)
        self.assertEqual((1,5,0), b.checkWin())

    def testHorisontal(self):
        b = Board(6)
        b.drop(1,1)
        b.drop(2,1)
        b.drop(3,1)
        b.drop(4,1)
        self.assertEqual((1,1,0), b.checkWin())
        b = Board(6)
        b.drop(1,1)
        b.drop(2,1)
        b.drop(3,2)
        b.drop(4,1)
        b.drop(1,1)
        b.drop(2,1)
        b.drop(3,1)
        b.drop(4,1)
        self.assertEqual((1,1,1), b.checkWin())

    def testDiagonal(self):
        b = Board(6)
        b.drop(1,1)
        b.drop(2,0)
        b.drop(2,1)
        b.drop(3,0)
        b.drop(3,0)
        b.drop(3,1)
        b.drop(4,0)
        b.drop(4,0)
        b.drop(4,0)
        b.drop(4,1)
        self.assertEqual((1,1,0), b.checkWin())
        
#logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%H:%M:%S')

if __name__ == "__main__":
    unittest.main()   